Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • #31
    Dear Tom Zylkin,

    Thank you for your reply, I really appreciate your time.

    As for questions 2) and 3), I think I have a solution for them. However for 1), since I won't be able to see any effects of the exporter country, do you think it is wise to use a product of those exporter variables to account for the exporter-year effects. For instance, I would use the product of GDP between Vietnam and its trading partner and say something like an increase in 1% of the product () will increase the export volume by x%.

    Comment


    • #32
      Hi Long Nguyenn,

      Before I answer any more of your questions, maybe you can help me get a better idea of the big picture. What is it you are trying to investigate using these regressions? What will the use of the estimates be in the end?

      Regards,
      Tom

      Comment


      • #33
        Dear Tom Zylkin,

        I am following these articles Do (2006), Nguyen (2010), Dinh, Hoang, & Nguyen (2013), Dao, Doan, & Pham (2014), Narayan & Nguyen (2015) and Rahman (2012) in finding the determining factors that affect export flows in Vietnam. In these articles, exchange rate and trade openness are often used as variables that contribute to trade flow.

        Comment


        • #34
          OK, I don't know any of these papers unfortunately. But if your intent is to follow them, then you can use the same specifications they do.

          Comment


          • #35
            Dear Tom Zylkin,

            Thank you for your answer. I am following the work of Egger and Pfaffermayr (2003) and in there I think they performed a regression of the individual effects, derived from the fixed effects estimator, on time-invariant variables such as distance, common language, etc. I was wondering if this method is still valid and if yes, how do I specify the individual effects to perform regression after having the results from ppmlhdfe?

            Comment


            • #36
              Originally posted by Long Nguyenn View Post
              Dear Tom Zylkin,

              Thank you for your answer. I am following the work of Egger and Pfaffermayr (2003) and in there I think they performed a regression of the individual effects, derived from the fixed effects estimator, on time-invariant variables such as distance, common language, etc. I was wondering if this method is still valid and if yes, how do I specify the individual effects to perform regression after having the results from ppmlhdfe?
              The Egger and Pfaffermayr paper you are describing doesn't sound like the one I am familiar with. But yes regressing fixed effects estimates on data is not uncommon. There is a paper by Egger and Ngai that advocates for this; perhaps that is the one you have in mind. If you want to save the fixed effects estimates using ppmlhdfe, you can use "savefe". Example:

              Code:
               ppmlhdfe exportvolume lnExrate lnEXPgdp lnIMPgdp lnEXPopen lnIMPopen, a(importer year, savefe) vce(cluster pairid)
              When you regress the fixed effects on the other variables, it may be necessary to include fixed effects in these regressions as well. For example, if you are using ij fixed effects, you should include an i fixed effect and a j fixed effect in the second regression.
              Last edited by Tom Zylkin; 18 Jun 2020, 07:09.

              Comment


              • #37
                Dear Tom Zylkin,

                Thank you very much!

                Comment


                • #38
                  Dear Tom Zylkin,

                  Sorry to bother you again but I have some more questions. I was not able to find a lot of examples to clear my confusion regardings how to use savefe. After I included savefe, the ppmlhdfe estimator generated two variables, _hdfe1_ for importer and _hdfe2_ for year.

                  I am assuming that I will have to generate a new variable that is the product of the two FEs. I was wondering that besides variables such as distance and dummy variables such as FTA, WTO, etc, would these variables help me find the effect of exporter's variables such as exchange rate and GDP since the year fixed effects absorb exporter? Since you recommended me to include fixed effects in the regression, which command should I use, predict or xtreg, and how would the code look like? If you can provide me with a document that has instruction or examples on how to use savefe that would be great.

                  Thank you so much and I am sorry to bother you again.

                  Comment


                  • #39
                    Originally posted by Long Nguyenn View Post
                    Dear Tom Zylkin,

                    Sorry to bother you again but I have some more questions. I was not able to find a lot of examples to clear my confusion regardings how to use savefe. After I included savefe, the ppmlhdfe estimator generated two variables, _hdfe1_ for importer and _hdfe2_ for year.

                    I am assuming that I will have to generate a new variable that is the product of the two FEs. I was wondering that besides variables such as distance and dummy variables such as FTA, WTO, etc, would these variables help me find the effect of exporter's variables such as exchange rate and GDP since the year fixed effects absorb exporter? Since you recommended me to include fixed effects in the regression, which command should I use, predict or xtreg, and how would the code look like? If you can provide me with a document that has instruction or examples on how to use savefe that would be great.

                    Thank you so much and I am sorry to bother you again.
                    The _hdfe1_ for importer and _hdfe2_ variables contain the estimates for the 2 fixed effects in your model. To be clear, if your model is y=exp(a_1 + a+2 + bX) + e, _hdfe1_ is a_1 and _hdfe2_ is a_2.

                    Assuming _hdfe2_ is the year fixed effect, it sounds you like would regress it on the exporter's log GDP etc based on what you're trying to do.

                    Regards,
                    Tom



                    Comment


                    • #40
                      Dear Tom Zylkin,

                      I have tried the following:

                      Code:
                      ppmlhdfe exportvolume lnVNGDP lnImpGDP lnVNNEER lnImpNEER lnDist commonborder landlocked wto asean apec crisis, a(importer year, savefe) vce(cluster importer)
                      Code:
                      HDFE PPML regression                              No. of obs      =      1,625
                      Absorbing 2 HDFE groups                           Residual df     =         57
                      Statistics robust to heteroskedasticity           Wald chi2(5)    =      25.52
                      Deviance             =  185659.6429               Prob > chi2     =     0.0001
                      Log pseudolikelihood = -97913.07744               Pseudo R2       =     0.9633
                      
                      Number of clusters (importer)=        58
                                                    (Std. Err. adjusted for 58 clusters in importer)
                      ------------------------------------------------------------------------------
                                   |               Robust
                      exportvolume |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
                      -------------+----------------------------------------------------------------
                           lnVNGDP |          0  (omitted)
                          lnImpGDP |   .4241066   .1710377     2.48   0.013     .0888789    .7593344
                          lnVNNEER |          0  (omitted)
                         lnImpNEER |  -.2039754   .2285896    -0.89   0.372    -.6520029     .244052
                            lnDist |          0  (omitted)
                      commonborder |          0  (omitted)
                        landlocked |          0  (omitted)
                               wto |   .0569609   .0791874     0.72   0.472    -.0982435    .2121654
                             asean |  -1.008433    .585759    -1.72   0.085      -2.1565    .1396336
                              apec |  -.4914929   .4100194    -1.20   0.231    -1.295116    .3121303
                            crisis |          0  (omitted)
                             _cons |   5.616598   1.479895     3.80   0.000     2.716058    8.517138
                      ------------------------------------------------------------------------------
                      Code:
                      reg __hdfe2__ lnVNGDP lnVNNEER, vce(cluster importer)
                      Code:
                      Linear regression                               Number of obs     =      1,625
                                                                      F(2, 57)          >   99999.00
                                                                      Prob > F          =     0.0000
                                                                      R-squared         =     0.9716
                                                                      Root MSE          =     .25906
                      
                                                    (Std. Err. adjusted for 58 clusters in importer)
                      ------------------------------------------------------------------------------
                                   |               Robust
                         __hdfe2__ |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                      -------------+----------------------------------------------------------------
                           lnVNGDP |   1.935214   .0030236   640.04   0.000      1.92916    1.941269
                          lnVNNEER |   1.467321   .0126616   115.89   0.000     1.441966    1.492675
                             _cons |  -20.78136   .0780774  -266.16   0.000    -20.93771   -20.62501
                      ------------------------------------------------------------------------------
                      Code:
                      reg __hdfe1__ lnDist crisis commonborder landlocked, vce(cluster importer)
                      Code:
                      Linear regression                               Number of obs     =      1,625
                                                                      F(4, 57)          =      15.64
                                                                      Prob > F          =     0.0000
                                                                      R-squared         =     0.4369
                                                                      Root MSE          =     1.2374
                      
                                                    (Std. Err. adjusted for 58 clusters in importer)
                      ------------------------------------------------------------------------------
                                   |               Robust
                         __hdfe1__ |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                      -------------+----------------------------------------------------------------
                            lnDist |  -1.084922   .1976587    -5.49   0.000    -1.480727   -.6891176
                            crisis |   .0037514   .0251073     0.15   0.882    -.0465252     .054028
                      commonborder |   .6473828   .9812621     0.66   0.512    -1.317561    2.612326
                        landlocked |     -1.189   .3953578    -3.01   0.004    -1.980691   -.3973099
                             _cons |   7.607684   1.748039     4.35   0.000     4.107297    11.10807
                      ------------------------------------------------------------------------------
                      I also tried to include year_* to the regression with __hdfe2__ and importer_* to the regression of __hdfe1__.

                      Code:
                      . reg __hdfe2__ lnVNGDP lnVNNEER year_*, vce(cluster importer)
                      Linear regression                               Number of obs     =      1,615
                                                                      F(0, 56)          =          .
                                                                      Prob > F          =          .
                                                                      R-squared         =     1.0000
                                                                      Root MSE          =          0
                      
                                                    (Std. Err. adjusted for 57 clusters in importer)
                      ------------------------------------------------------------------------------
                                   |               Robust
                         __hdfe2__ |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                      -------------+----------------------------------------------------------------
                           lnVNGDP |   1.333287   5.44e-15  2.5e+14   0.000     1.333287    1.333287
                          lnVNNEER |          0  (omitted)
                      Code:
                      . reg __hdfe1__ lnDist crisis commonborder landlocked importer_*, vce(cluster importer)
                      Linear regression                               Number of obs     =      1,615
                                                                      F(0, 56)          =          .
                                                                      Prob > F          =          .
                                                                      R-squared         =     1.0000
                                                                      Root MSE          =          0
                      
                                                    (Std. Err. adjusted for 57 clusters in importer)
                      ------------------------------------------------------------------------------
                                   |               Robust
                         __hdfe1__ |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                      -------------+----------------------------------------------------------------
                            lnDist |  -1.162391   1.16e-12 -1.0e+12   0.000    -1.162391   -1.162391
                            crisis |  -4.97e-15   7.47e-16    -6.65   0.000    -6.47e-15   -3.47e-15
                      commonborder |   1.662662   2.30e-12  7.2e+11   0.000     1.662662    1.662662
                        landlocked |  -3.608236   2.53e-12 -1.4e+12   0.000    -3.608236   -3.608236
                      I am not sure which one is the right way to do this.

                      Comment


                      • #41
                        Hi Long Nguyenn,

                        In the second regression, you are clustering by importer, but your year FEs do not vary by importer. This is why your standard errors are so small. You should either cluster by year or use one observation per year.

                        The third regression looks fine. Notice that the results are pretty reasonable.

                        The fourth regression doesn't make sense. If the dependent variable is a year fixed effect, you can't include a year dummy on the RHS, because that is the same thing as a year fixed effect.

                        Likewise, you cannot regress an importer fixed effect on an importer dummy in the 5th regression.

                        Regards,
                        Tom

                        Comment


                        • #42
                          Thank you very much Tom Zylkin

                          Best,
                          Long Nguyen

                          Comment


                          • #43
                            Originally posted by Tom Zylkin View Post
                            Hi Carlos,

                            The reason your estimates for GDP may be different is because you also include the log of each country's population (the two are likely very correlated.) In any case, GDPs are usually treated as only a control; I would not worry about whether the coefficients are 1 or not.

                            To estimate the same model using ppml, I believe you should be able to input:

                            xi i.exp_TIFE i.imp_TIFE i.TFE
                            ppml x log_distw log_pop_d log_pop_o log_gdp_d log_gdp_o contig comlang_off col45 gatt_o gatt_d fta_wto _Iexp_TIFE* _IimpTIFE* _ITFE*


                            This exercise should also help to clarify the difference between the two commands: ppml doesn't treat fixed effects any differently than other regressors, whereas ppmlhdfe uses a special algorithm that avoids creating a new column for each dummy variable that would be needed. This makes ppmlhdfe much faster for problems that involve fixed effects and similar regressors.

                            Regards,
                            Tom
                            Hello,

                            I am trying to follow up the conversation.

                            When i use the command to create the fixed effects, am getting this result "variable not found".

                            How do we create the dummy variables for the fixed effects?

                            NB: I am also using ppmlhdfe command.
                            Regards
                            Gabriel

                            Comment


                            • #44
                              Originally posted by Gabriel Kwenda View Post

                              Hello,

                              I am trying to follow up the conversation.

                              When i use the command to create the fixed effects, am getting this result "variable not found".

                              How do we create the dummy variables for the fixed effects?

                              NB: I am also using ppmlhdfe command.
                              Regards
                              Gabriel
                              Hi Gabriel,

                              You can try following the example on our github, specifically example 3:

                              https://github.com/sergiocorreia/ppm...es/examples.do

                              Regards,
                              Tom

                              Comment


                              • #45
                                Originally posted by Tom Zylkin View Post

                                Hi Gabriel,

                                You can try following the example on our github, specifically example 3:

                                https://github.com/sergiocorreia/ppm...es/examples.do

                                Regards,
                                Tom
                                Hi Tom,

                                I did follow up and i was able to understand and recreate the fixed effects from the example 3. But i still have a setback.

                                When i used the procedure with my data set, stata reported back that i have "insufficient observations".

                                I know that this means i needed to boost up my sample size.
                                ​​​​​​
                                ​​​​​​Here is my experience:
                                ✓ I have 27 country pairs with Exporting country of interest (Malawi). I started with 2001 to 2019 hence 514 observations. This was the first fail at generating fixed effects.
                                ✓ second i expanded from 2001 to 1991. Failed again.
                                ✓ third, i expanded further to 1962, nothing changed.

                                I have considered using "months instead of years" as time frame but issue of getting the required variables in months has been a setback.

                                Will using the ppmlhdfe without applying the fixed effects be okay?

                                Kind regards
                                Gabriel

                                Comment

                                Working...
                                X